﻿using System.Collections.Generic;
using System;

namespace Engine
{
    ///<summary>Define interface for common operations on lattice</summary>
    [Serializable]
    public abstract class Lattice
    {
        /// <summary>
        /// lattice id. Used in series of experiments
        /// </summary>
        private long _id;
        
        /// <summary>
        /// Lattice id
        /// </summary>
        public long Id 
        {
            get { return _id;  }
            set { _id = value; }
        }

        /// <summary>get list of working points.</summary> 
        public abstract IList<Point> Points { get; }

        /// <summary>get list of working _bonds.</summary> 
        public abstract IList<Bond> Bonds { get; }

        /// <summary>lenght of lattice in x direction.</summary> 
        public abstract int X { get; set; }

        /// <summary>lenght of lattice in y direction.</summary> 
        public abstract int Y { get; set; }

        /// <summary>lenght of lattice in z direction.</summary> 
        public abstract int Z { get; set; }

        ///<summary>Number of cutted points.</summary>
        public abstract int CuttedPoints { get; }

        ///<summary>Number of working points.</summary>
        public abstract int WorkingPoints { get; }

        ///<summary>Number of cutted bonds.</summary>
        public abstract int CuttedBonds { get; }

        ///<summary>Number of cutted bonds.</summary>
        public abstract int WorkingBonds { get; }
        
        /// <summary>
        /// Percentage of working bond
        /// </summary>
        public double XBonds 
        { 
            get
            {
                return ((double)WorkingBonds) / (WorkingBonds + CuttedBonds);           
            }        
        }

        ///<summary>Dimension of lattice.</summary>
        public abstract int Dimension { get; }

        ///<summary>Conductance of lattice.</summary>
        public abstract double Conductance { get; }

        ///<summary>Cut one random bond from lattice.</summary> 
        public abstract void CutBond();

        ///<summary>Cut one random point from lattice.</summary> 
        public abstract void CutPoint();

        ///<summary>Test lattice for conductivity.</summary> 
        public abstract bool IsConduct();

        /// <summary>we restart state of lattice for its default state.</summary> 
        public abstract void Reset();
    }
}
